package com.servlet;

import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.io.PrintWriter;

public class FirstServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("*************这是doGet方法执行");
        //完成业务功能 ----跳转到myFirst.jsp
//        resp.sendRedirect("myFirst.jsp");
        PrintWriter out = resp.getWriter();
        out.println("abcdefgHIK");
        out.print("202300001 小菊");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        System.out.println("************这是doPost方法执行");
        doGet(req,resp);
    }
}
